31inline Eigen::Transform<typename D1::Scalar, 2, Eigen::Isometry>
toIsometry2d(
const Eigen::MatrixBase<D1>& translation,
32 const double& rotation)
36 return Eigen::Translation<typename D1::Scalar, 2>(translation) * Eigen::Rotation2D<typename D1::Scalar>(rotation);
41template <
typename D1,
typename D2>
42inline Eigen::Transform<typename D1::Scalar, 2, Eigen::Isometry>
toIsometry2d(
const Eigen::MatrixBase<D1>& translation,
43 const Eigen::MatrixBase<D2>& rotation)
54inline Eigen::Transform<typename D1::Scalar, 2, Eigen::Isometry>
toIsometry2d(
const Eigen::MatrixBase<D1>& trf)
58 return toIsometry2d(Eigen::Matrix<typename D1::Scalar, 2, 1>(trf(0), trf(1)), trf(2));
70template <
typename D1,
typename D2>
71inline Eigen::Transform<typename D1::Scalar, 3, Eigen::Isometry>
toIsometry3d(
72 const Eigen::MatrixBase<D1>& translation,
73 const Eigen::QuaternionBase<D2>& rotation)
77 return Eigen::Translation<typename D1::Scalar, 3>(translation) * rotation;
82template <
typename D1,
typename D2>
83inline Eigen::Transform<typename D1::Scalar, 3, Eigen::Isometry>
toIsometry3d(
const Eigen::MatrixBase<D1>& translation,
84 const Eigen::MatrixBase<D2>& rotation)
91 Eigen::Quaternion<typename D2::Scalar>(Eigen::Matrix<typename D2::Scalar, 4, 1>(rotation).normalized()));
97inline Eigen::Transform<typename D1::Scalar, 3, Eigen::Isometry>
toIsometry3d(
const Eigen::MatrixBase<D1>& trf)
100 return toIsometry3d(Eigen::Matrix<typename D1::Scalar, 3, 1>(trf(0), trf(1), trf(2)),
101 Eigen::Quaternion<typename D1::Scalar>(trf(6), trf(3), trf(4), trf(5)));
113inline Eigen::Vector3d
toVector(
const Eigen::Isometry2d& trf)
115 return (Eigen::Vector3d() << trf.translation(), Eigen::Rotation2Dd(trf.rotation()).angle()).finished();
122 return (
Eigen::Vector7d() << trf.translation(), Eigen::Quaterniond(trf.rotation()).coeffs().normalized())
130 return Eigen::Translation3d((Eigen::Vector3d() << trf_2d.translation(), 0).finished()) *
131 Eigen::AngleAxisd(Eigen::Rotation2Dd(trf_2d.rotation()).angle(), Eigen::Vector3d::UnitZ());
136inline Eigen::Isometry2d
projectTo2d(
const Eigen::Isometry3d& trf_3d)
138 return Eigen::Translation2d(trf_3d.translation().head<2>()) *
139 Eigen::Rotation2Dd(
getYaw(trf_3d.rotation().matrix()));
Composite of state vectors.
Definition: vector_composite.h:29
Matrix< double, 7, 1 > Vector7d
7-vector of real double type
Definition: wolf.h:103
Definition: capture_base.h:23
Eigen::Transform< typename D1::Scalar, 2, Eigen::Isometry > toIsometry2d(const Eigen::MatrixBase< D1 > &translation, const double &rotation)
Isometry 2d from a translation and an angle.
Definition: isometry_conversions.h:31
Eigen::Transform< typename D1::Scalar, 3, Eigen::Isometry > toIsometry3d(const Eigen::MatrixBase< D1 > &translation, const Eigen::QuaternionBase< D2 > &rotation)
Isometry 3d from a translation and a quaternion.
Definition: isometry_conversions.h:71
Eigen::Isometry3d inverseProjectTo3d(const Eigen::Isometry2d &trf_2d)
Isometry 3d of an isometry 2d: in the plane z = 0, rotating about the z axis.
Definition: isometry_conversions.h:128
Eigen::Isometry2d projectTo2d(const Eigen::Isometry3d &trf_3d)
Isometry 2d of an isometry 3d: its x, y translation and its yaw.
Definition: isometry_conversions.h:136
Eigen::MatrixBase< Derived >::Scalar getYaw(const Eigen::MatrixBase< Derived > &_M)
Yaw angle of a rotation matrix or of a quaternion given as a 4-vector [x, y, z, w].
Definition: rotations.h:230
Eigen::Vector3d toVector(const Eigen::Isometry2d &trf)
Pose 3-vector [x, y, theta] of an isometry 2d.
Definition: isometry_conversions.h:113
static void check(const T &t)
Asserts the matrix size dynamically or statically.
Definition: wolf.h:194